/*********************************************************************************
 * 
 * Author: wujunjie
 * Create Date: 2014-05-10
 * Description:
 *          
 * Revision History:
 *      Date          Author               Description
 * 
*********************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DataFrameworkAccess;
using Xinkui.Entity.AutoGenerator;
using Xinkui.Common;
namespace Xinkui.DataAccess.AutoGenerator {
    public partial class CompanyInfoMaintainDataAccess {
        public List<CompanyInfoMaintain_Entity> CompanyInfoMaintain_ListByPaging(int pageSize, int pageIndex, out int total) {
            total = 0;
            try {
                int tempRecord = 0;
                DataCommand cmd = DataCommandManager.GetDataCommand("CompanyInfoMaintain_ListByPaging");
                cmd.SetParameterValue("@PageSize", pageSize);
                cmd.SetParameterValue("@PageIndex", pageIndex);
                cmd.SetParameterValue("@RecordCount", tempRecord);
                List<CompanyInfoMaintain_Entity> pageList = cmd.ExecuteEntityList<CompanyInfoMaintain_Entity>();
                total = Convert.ToInt32(cmd.GetParameterValue("@RecordCount"));
                return pageList;
            }
            catch (Exception ex) {
                ExceptionHelper.ProcessException(ex);
            }

            return new List<CompanyInfoMaintain_Entity>(0);

        }

        public CompanyInfoMaintain_Entity CompanyInfoMaintain_View(System.Int32 CompanyID) {
            CompanyInfoMaintain_Entity c = default(CompanyInfoMaintain_Entity);
            try {
                DataCommand cmd = DataCommandManager.GetDataCommand("CompanyInfoMaintain_View");
                cmd.SetParameterValue("@CompanyID", CompanyID);
                c = cmd.ExecuteEntity<CompanyInfoMaintain_Entity>();
            }
            catch (Exception ex) {
                ExceptionHelper.ProcessException(ex);
            }
            return c;
        }

        public CompanyInfoMaintain_Entity CompanyInfoMaintain_Add(CompanyInfoMaintain_Entity entity) {
            try {
                DataCommand cmd = DataCommandManager.GetDataCommand("CompanyInfoMaintain_Add");
                cmd.SetParameterValue("@CompanyID", entity.CompanyID);
                cmd.SetParameterValue("@CatalogId", entity.CatalogId);
                cmd.SetParameterValue("@CompanyName", entity.CompanyName);
                cmd.SetParameterValue("@CnCompanyName", entity.CnCompanyName);
                cmd.SetParameterValue("@KeyWord", entity.KeyWord);
                cmd.SetParameterValue("@CompanyDescription", entity.CompanyDescription);
                cmd.SetParameterValue("@MainProduct", entity.MainProduct);
                cmd.SetParameterValue("@CompanyEmail", entity.CompanyEmail);
                cmd.SetParameterValue("@CountryID", entity.CountryID);
                cmd.SetParameterValue("@ProvinceID", entity.ProvinceID);
                cmd.SetParameterValue("@CityID", entity.CityID);
                cmd.SetParameterValue("@IsOE", entity.IsOE);
                cmd.SetParameterValue("@BussinessType", entity.BussinessType);
                cmd.SetParameterValue("@StreetAddress", entity.StreetAddress);
                cmd.SetParameterValue("@PostCode", entity.PostCode);
                cmd.SetParameterValue("@NumberofEmployees", entity.NumberofEmployees);
                cmd.SetParameterValue("@NumberofRDEmployees", entity.NumberofRDEmployees);
                cmd.SetParameterValue("@Ceo", entity.Ceo);
                cmd.SetParameterValue("@YearEstabished", entity.YearEstabished);
                cmd.SetParameterValue("@IsExport", entity.IsExport);
                cmd.SetParameterValue("@ExportMarket", entity.ExportMarket);
                cmd.SetParameterValue("@RegisterCapital", entity.RegisterCapital);
                cmd.SetParameterValue("@TotalAnnualSales", entity.TotalAnnualSales);
                cmd.SetParameterValue("@ExportRatio", entity.ExportRatio);
                cmd.SetParameterValue("@TypicalClients", entity.TypicalClients);
                cmd.SetParameterValue("@OwnershipType", entity.OwnershipType);
                cmd.SetParameterValue("@PhoneNum", entity.PhoneNum);
                cmd.SetParameterValue("@FaxNum", entity.FaxNum);
                cmd.SetParameterValue("@WebSite", entity.WebSite);
                cmd.SetParameterValue("@Logo", entity.Logo);
                cmd.SetParameterValue("@ImagePhoto", entity.ImagePhoto);
                cmd.SetParameterValue("@MemberType", entity.MemberType);
                cmd.SetParameterValue("@CreateDate", entity.CreateDate);
                cmd.SetParameterValue("@CreateIp", entity.CreateIp);
                cmd.SetParameterValue("@UpdateDate", entity.UpdateDate);
                cmd.SetParameterValue("@UpdateIp", entity.UpdateIp);
                cmd.SetParameterValue("@AuditStatus", entity.AuditStatus);
                cmd.SetParameterValue("@IsDeleted", entity.IsDeleted);
                cmd.ExecuteNonQuery();
            }
            catch (Exception ex) {
                ExceptionHelper.ProcessException(ex);
            }

            return entity;
        }

        public bool CompanyInfoMaintain_Update(CompanyInfoMaintain_Entity entity) {
            bool succ = false;
            try {
                DataCommand cmd = DataCommandManager.GetDataCommand("CompanyInfoMaintain_Update");
                cmd.SetParameterValue("@CompanyID", entity.CompanyID);
                cmd.SetParameterValue("@CatalogId", entity.CatalogId);
                cmd.SetParameterValue("@CompanyName", entity.CompanyName);
                cmd.SetParameterValue("@CnCompanyName", entity.CnCompanyName);
                cmd.SetParameterValue("@KeyWord", entity.KeyWord);
                cmd.SetParameterValue("@CompanyDescription", entity.CompanyDescription);
                cmd.SetParameterValue("@MainProduct", entity.MainProduct);
                cmd.SetParameterValue("@CompanyEmail", entity.CompanyEmail);
                cmd.SetParameterValue("@CountryID", entity.CountryID);
                cmd.SetParameterValue("@ProvinceID", entity.ProvinceID);
                cmd.SetParameterValue("@CityID", entity.CityID);
                cmd.SetParameterValue("@IsOE", entity.IsOE);
                cmd.SetParameterValue("@BussinessType", entity.BussinessType);
                cmd.SetParameterValue("@StreetAddress", entity.StreetAddress);
                cmd.SetParameterValue("@PostCode", entity.PostCode);
                cmd.SetParameterValue("@NumberofEmployees", entity.NumberofEmployees);
                cmd.SetParameterValue("@NumberofRDEmployees", entity.NumberofRDEmployees);
                cmd.SetParameterValue("@Ceo", entity.Ceo);
                cmd.SetParameterValue("@YearEstabished", entity.YearEstabished);
                cmd.SetParameterValue("@IsExport", entity.IsExport);
                cmd.SetParameterValue("@ExportMarket", entity.ExportMarket);
                cmd.SetParameterValue("@RegisterCapital", entity.RegisterCapital);
                cmd.SetParameterValue("@TotalAnnualSales", entity.TotalAnnualSales);
                cmd.SetParameterValue("@ExportRatio", entity.ExportRatio);
                cmd.SetParameterValue("@TypicalClients", entity.TypicalClients);
                cmd.SetParameterValue("@OwnershipType", entity.OwnershipType);
                cmd.SetParameterValue("@PhoneNum", entity.PhoneNum);
                cmd.SetParameterValue("@FaxNum", entity.FaxNum);
                cmd.SetParameterValue("@WebSite", entity.WebSite);
                cmd.SetParameterValue("@Logo", entity.Logo);
                cmd.SetParameterValue("@ImagePhoto", entity.ImagePhoto);
                cmd.SetParameterValue("@MemberType", entity.MemberType);
                cmd.SetParameterValue("@CreateDate", entity.CreateDate);
                cmd.SetParameterValue("@CreateIp", entity.CreateIp);
                cmd.SetParameterValue("@UpdateDate", entity.UpdateDate);
                cmd.SetParameterValue("@UpdateIp", entity.UpdateIp);
                cmd.SetParameterValue("@AuditStatus", entity.AuditStatus);
                cmd.SetParameterValue("@IsDeleted", entity.IsDeleted);
                cmd.ExecuteNonQuery();
                succ = true;
            }
            catch (Exception ex) {
                ExceptionHelper.ProcessException(ex);
            }
            return succ;
        }

        public bool CompanyInfoMaintain_Delete(System.Int32 CompanyID) {
            bool succ = false;
            try {
                DataCommand cmd = DataCommandManager.GetDataCommand("CompanyInfoMaintain_Delete");
                cmd.SetParameterValue("@CompanyID", CompanyID);
                cmd.ExecuteNonQuery();
                succ = true;
            }
            catch (Exception ex) {
                ExceptionHelper.ProcessException(ex);
            }
            return succ;
        }

    }
}
